<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    <%@include file="../common/common.jsp" %>
    <meta charset="UTF-8">
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
  </head>
  
  <body>
  	<c:if test="${!empty msg}">
		<div class="alert alert-danger alert-dismissable" style="text-align: center;">  
	      <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>  
	      <strong>提示!</strong>${msg }
	  	</div>  
  	</c:if>
  	
    <form name="frm" action="process/saveCalendar.do" method="post" class="definewidth m20">
		<input type="hidden" name="action" value="${param.action }" />
	    <table class="table table-bordered table-hover definewidth m10">
	        <tr>
	            <td width="10%" class="tableleft">序号</td>
	            <td><input type="text" name="seq" id="seq" value="${info.seq }"/></td>
	        </tr>
	        <tr>
	            <td class="tableleft">课程号</td>
	            <td><input type="text" name="course_num" id="course_num" value="${info.course_num }"/></td>
	        </tr>
	        <tr>
	            <td class="tableleft">课程名</td>
	            <td>
	            	<select name="course_name" id="course_name">
	            		<option value="">请选择课程名</option>
	            		<c:forEach items="${listCourse }" var="courseInfo">
	            			<option value="${courseInfo.id }">${courseInfo.name }</option>
	            		</c:forEach>
	            	</select>
	            </td>
	        </tr>
	        <tr>
	            <td class="tableleft">课程种类</td>
	            <td>
	            	<select name="course_type" id="course_type">
	            		<option value="1">一般课程</option>
	            		<option value="2">特殊课程</option>
	            	</select>
	            </td>
	        </tr>
	        <tr>
	            <td class="tableleft">行政班</td>
	            <td>
	                <select multiple="multiple" name="xz_class" id="xz_class">
	                	<option value="">请至少选择一个班级</option>
	            		<c:forEach items="${listClass }" var="classInfo">
	            			<option value="${classInfo.id }" <c:if test="${classInfo.id eq param.xz_class }">selected</c:if> >${classInfo.name }</option>
	            		</c:forEach>
	                </select>
	            </td>
	        </tr>
	        <tr>
	            <td class="tableleft">教师</td>
	            <td>
	            	<select name="teacher" id="teacher">
	            		<option value="1">张老师</option>
	            		<option value="2">杨老师</option>
	            	</select>
	        </tr>
	        <tr>
	            <td class="tableleft">实际</td>
	            <td><input type="text" name="fact" id="fact" value="${info.fact }"/></td>
	        </tr>
	        <tr>
	            <td class="tableleft">上限</td>
	            <td><input type="text" name="upper_limit" id='upper_limit' value="${info.upper_limit }"/></td>
	        </tr>
	        <tr>
	            <td class="tableleft">学时</td>
	            <td><input type="text" name="class_hour" id="class_hour" value="${info.class_hour }"/></td>
	        </tr>
	        <tr>
	            <td class="tableleft">学分</td>
	           	<td><input type="text" name="credit_hour" id="credit_hour" value="${info.credit_hour }"/></td>
	        </tr>
	        <tr>
	            <td class="tableleft">起始周</td>
	            <td><input type="text" name="week" id="week" value="${info.week }"/></td>
	        </tr>
	        <tr>
	            <td class="tableleft">考核方式</td>
	            <td>
	            	<select name="check_type" id="check_type">
	                	<option value="1">考查</option>
	                	<option value="2">考试</option>
	                </select>
	            </td>
	        </tr>
	        <tr>
	            <td class="tableleft">任务类型</td>
	            <td>
	            	<select name="task_type" id="task_type">
	            		<option value="1">陆上任务</option>
	                	<option value="2">海上任务</option>
	            	</select>
	            </td>
	        </tr>
	        <tr>
	            <td class="tableleft"></td>
	            <td>
	                <button type="type" class="btn btn-primary" id="btnSave" type="button">保存</button>				 &nbsp;&nbsp;
	                <button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
	            </td>
	        </tr>
	    </table>
	</form>
  </body>
</html>
<script>
    $(function () {       
		$('#backid').click(function(){
			window.location.href="process/queryCalendar.do";
		});
		$('#btnSave').click(function(){
			var v=true;
			$(":text").each(function (){
				var _this=$(this);
				if(_this.val()==''){
					_this.addClass("error")
					v=false;
				}
			});
			if(v!=true){
				alert("您录入的参数不完整");
				return;
			}
			document.frm.submit()
		});
    });    
</script>